Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do a full reformat when ^L/^R redrawing. #107

Merged
merged 1 commit into from
Feb 27, 2022
Merged

Do a full reformat when ^L/^R redrawing. #107

merged 1 commit into from
Feb 27, 2022

Conversation

johnsonjh
Copy link
Contributor

See issue #104 - adding a new step of "inputting four or five backspaces" to exit the command input leaves the screen in a state where ^L or ^R will not correct corruption until a reformat (:set nonum|set num, etc).

This is possible in other situations as well.

This ensures the screen is always reformatted and redrawn on ^L or ^R.

@johnsonjh
Copy link
Contributor Author

Not that this isn't a fix for #104 but a workaround for this and other potential issues. I've not fully looked into #104 to see what a proper fix is yet, maybe you'll beat me to it.

@lichray
Copy link
Owner

lichray commented Feb 27, 2022

Doesn't sound too useful? A quicker workaround for #104 might be Ctrl-C.

@johnsonjh
Copy link
Contributor Author

johnsonjh commented Feb 27, 2022

That works only if you are still inputting the command, on the command input line. If you have exited without interrupting, such as backspacing out of the command input, the screen remains corrupted then cannot be recovered with ^C/^L/^R.

This patch is more a "fix" that is compatible with my muscle memory, and I think it is closer to the POSIX standard.

The short description from the POSIX-derived man page states that ^L should behave as follows:

"If in open mode, clear the screen and redisplay the current line. Otherwise, clear and redisplay the screen. Current line is unchanged. Current column is unchanged."

Nvi has no full open mode. Also, Nvi has never actually "cleared the screen" directly, leaving the decision up to curses, however, the standard also doesn't directly specify if the screen should actually be fully repainted (which I think it should, as that is what the clear implies) or just redrawn (as is, even if it was wrong).

Using ^C in the situation above just prints Interrupted but doesn't change the screen contents as you can see below:

0BA5E844-8DB0-4D9F-BD86-9355F114672A

@lichray
Copy link
Owner

lichray commented Feb 27, 2022

If that's your muscle memory, then you can simply

map ^R z^M

(See also z command in man nvi)

@johnsonjh
Copy link
Contributor Author

johnsonjh commented Feb 27, 2022

z still doesn't actually fix the screen. I'll attach a video with keystrokes visible.

@johnsonjh
Copy link
Contributor Author

johnsonjh commented Feb 27, 2022

NOTE: The ^R at the end does work only because this PR is applied to this build.

MOV: https://user-images.githubusercontent.com/61629094/155870161-ddb3bdd8-a415-46de-9b0b-9cf9566291af.MOV

Hopefully this is helpful.

@lichray
Copy link
Owner

lichray commented Feb 27, 2022

z<carriage-return> is the full form, that's why there is an extra ^M at the end of the mapping. So when typing, it's z<enter> rather than z<esc>.

2022-02-26.22-11-34.mp4

I think the only problem is that it will move the current line to the top...

@lichray lichray merged commit 16748b8 into lichray:main Feb 27, 2022
@johnsonjh
Copy link
Contributor Author

Ah, yes, right you are. But moving the screen is still a problem.

This is something I'd most likely never have noticed outside of the context of #104 ... I'll take a look into that tomorrow, unless you beat me to it, as it's getting late here on the east coast.

But, I see you merged, so thanks very much for the quick response on these. Nvi2 is the most awesome nvi yet.

@johnsonjh johnsonjh deleted the redraw-l branch February 27, 2022 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants